/**
 * Created by zhangb on 2015/9/5.
 */


function convertToArray(nodes)
{
    var array = null;
    try{
        array = Array.prototype.slice.call(nodes,0);
    } catch (ex){
        array = new Array();
        for(var i= 0,len = nodes.length;i<len;i++){
            array.push(nodes[i]);
        }
    }

    return array;
}

//加载外部js文件

function loadScript(url)
{
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.src = url;
    document.body.appendChild(script);
}

function loadScriptString(code)
{
    var script = document.createElement("script");
    script.type = "text/javascript";
    try{
        script.appendChild(document.createTextNode(code));
    } catch(ex){
        script.text = code;
    }
    document.body.appendChild(script);
}

//加载css文件

function loadStyles(url)
{
    var link = document.createTextNode("link");
    link.rel = "stylesheet";
    link.type = "text/css";
    link.href = url;
    var head = document.getElementsByTagName("head")[0];
    head.appendChild(head);
}

function loadStyleString(code)
{

}